# The main logic of the game
Powerup = 1
Defence = 0
Attack = -1
Unknow = -2



class Player:
    def __init__(self):
        self.power = 0
        self.recode = [Unknow] * 100

    def powerup(self, turn):
        self.recode[turn] = Powerup
        self.power = self.power + 1
        return Powerup

    def defence(self, turn):
        if self.recode[turn - 1] != Defence:
            self.recode[turn] = Defence
            return Defence
        else:
            pass

    def attack(self, turn):
        if (self.power > 0):
            self.recode[turn] = Attack
            self.power = self.power - 1
            return Attack
        else:
            pass

    def get_action_num(self, turn=1, Action=Attack):
        num = 0
        for x in self.recode[1:turn + 1]:
            if x == Action:
                num = num + 1
        return num

    def get_series_action_num(self, turn=1, Action=Attack):
        num = 0
        maxnum = 0
        for x in self.recode[1:turn + 1]:
            if x == Action:
                num = num + 1
                maxnum = max(maxnum, num)
            else:
                num = 0
        return maxnum